<script type="text/javascript" >
    jQuery(document).ready(function(){
        jQuery('.stExtra').remove();
    });
    stSocialMediaToolbox.load_tooltip();
    stSocialMediaToolbox.loadUploadButton('200');
    stSocialMediaToolbox.loadRemoveButton();
        jQuery("a[rel^='prettyPhoto']").prettyPhoto({
            theme:'facebook',
            default_height:100,
            keyboard_shortcuts: false
        });
function make_pdf(){
    window.open('<?php echo get_bloginfo('url');?>/coupon/user_export.php?campain=<?php echo $template_id;?>&format=pdf');
}
</script>
<style>
    th.column-CouponUserID {
        width:100px;
    }
</style>
<div class="w100p bgl" id="stcontainer">
    <div class="w100p bgr p5b" id="result">
<table class="widefat" cellspacing="0">
                <thead>
                    <tr>
                        <?php print_column_headers('stFacebookToolbox_stFacebookToolbox'); ?>
                    </tr>
                </thead>

                <tbody>
                <?php
                if (count($results) > 0) {
                    
                    $tr_class = "";
                    $upload_data = wp_upload_dir();
                    foreach ($results as $result) {
                       $array = explode('-',substr($result->CouponGeneratedDateTime,0,10));
                        
                        $datetime = $array[2].'.'.$array[1].'.'.$array[0].' '.substr($result->CouponGeneratedDateTime,11);
                       // $description  = (strlen($result->CouponTemplateDescription) > 35)?substr($result->CouponTemplateDescription,0,35).'...':$result->CouponTemplateDescription;
                        if( empty($tr_class) || $tr_class == "class='bg_gray2'"){
                            $tr_class = "class='bg_gray1'";
                        }else{
                            $tr_class = "class='bg_gray2'";
                        }
                        echo "<tr id='$result->CouponUserID 	' $tr_class >"
                        . "<td>" 
                        . $model->getuser($result->CouponUserID)
                        . "</td>"
                        . "<td>"
                        . $datetime
                        . "</td>"
                        . "<td>"
                        . $model->gettemplate($result->CouponTemplateID)
                        . "</td>"
                        . "<td>";
                        if($result->QCCodePath != '')
                            echo "<a rel='prettyPhoto' href='$result->QCCodePath' title=''><img src='$result->QCCodePath' width='70' title='' /></a>";
                        echo  "</td>"
                        . "<td><a href='{$result->GeneratedCouponPath}' target='_blank'>Download PDF</a>"
                        . "</td>"
                          

                        . "</td>"
                        
                        . "</tr>"
                        ;
                    }
                }
                ?>
                </tbody>
            </table>
            <div class="page_d">
                <?php echo $pagination?>
                <div class="cl"></div>
            </div>
    </div>
</div>